package com.bw.liveplay.common.mvvm.viewmodel

import com.bw.liveplay.common.entity.BaseEntity
import com.bw.liveplay.common.entity.HomeFeedEntity
import com.bw.liveplay.common.mvvm.adapter.ImgAdapter
import com.bw.liveplay.common.mvvm.adapter.TextAdapter
import com.bw.liveplay.common.mvvm.mondel.HomeListModel
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

/**
 * @author KK
 * @description:
 * @date :2021/11/12 8:09
 *
 */
class TextViewModel : BaseViewModel<HomeListModel>() {
    public var adapter : TextAdapter = TextAdapter()
    override fun result(t: BaseEntity) {
        if(t is HomeFeedEntity){
            var homeFeedEntity = t as HomeFeedEntity
            adapter.setNewInstance(homeFeedEntity.data!!.data)
        }
    }

    override fun initData() {
        m.requestHomeList(0,"text",12,0)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(this)
    }
}